package br.ufrj.ad.estatistica;
import java.util.Random;

public class Amostragem {

	private final static long seed = new Random().nextLong();
	private final static Random rand = new Random(seed);
	
	
	public static double exponencial(final double taxa) {
		
		// taxa zero = não tem evento
		if (taxa <= 0) {
			return 0;
		}
		
		final double u = rand.nextDouble();
		return -Math.log(u) / taxa;
	}
	
	public static double uniforme() {
		return rand.nextDouble();
	}
}
